<?php
/**
 * @author wyl
 * @date 2015-10-23 12:53:45
 */
class AutobidMarker{
	private $_autionId;
	
	public function __construct(){
		
	}
	
	public function getAuctionId(){
		return $this->_autionId;	
	}
	
	public function setAuctionId($auctionId){
		$this->_autionId=$auctionId;
		return $this;
	}
	
	public function setMark($key,$value){
		$model=AutobidMark::model()->findByPk($this->_autionId.':'.$key);
		if (empty($model)) {
			$model=new AutobidMark();
		}
		$attributes=array(
			'id'		=>$this->_autionId.':'.$key,
			'value'		=>$value
		);
		$model->attributes=$attributes;
		return $model->save(); 
	}
	
	public function getMark($key){
		$model=new AutobidMark();
		$model=$model->findByPk($this->_autionId.':'.$key);
		if(empty($model)){
			return FALSE;
		}
		return $model->value;
	}
	
	public function delMark($key){
		return AutobidMark::model()->deleteByPk($this->_autionId.':'.$key);
	}
}